<?php require_once('../Connections/agriculture.php'); ?>
<?php

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") {
    $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

    switch ($theType) {
        case "text":
            $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
            break;
        case "long":
        case "int":
            $theValue = ($theValue != "") ? intval($theValue) : "NULL";
            break;
        case "double":
            $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
            break;
        case "date":
            $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
            break;
        case "defined":
            $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
            break;
    }
    return $theValue;
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
    $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
    $insertSQL = sprintf("INSERT INTO seeding (seeding_crop, seeding_choice, seeding_disinfect, seeding_stroma, seeding_sow_time, seeding_sow_light, seeding_sow_temp, seeding_sow_water, seeding_grow_term, seeding_grow_light, seeding_grow_dtemp, seeding_grow_ntemp, seeding_grow_water, seeding_young_term, seeding_young_light, seeding_young_dtemp, seeding_young_ntemp, seeidng_young_water) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['area1'], "text"), GetSQLValueString($_POST['area2'], "text"), GetSQLValueString($_POST['area3'], "text"), GetSQLValueString($_POST['area4'], "text"), GetSQLValueString($_POST['area5'], "text"), GetSQLValueString($_POST['area6'], "text"), GetSQLValueString($_POST['area7'], "text"), GetSQLValueString($_POST['area8'], "text"), GetSQLValueString($_POST['area9'], "text"), GetSQLValueString($_POST['area10'], "text"), GetSQLValueString($_POST['area10'], "text"), GetSQLValueString($_POST['area12'], "text"), GetSQLValueString($_POST['area13'], "text"), GetSQLValueString($_POST['area14'], "text"), GetSQLValueString($_POST['area15'], "text"), GetSQLValueString($_POST['area16'], "text"), GetSQLValueString($_POST['area17'], "text"), GetSQLValueString($_POST['area18'], "text"));

    mysql_select_db($database_agriculture, $agriculture);
    $Result1 = mysql_query($insertSQL, $agriculture) or die(mysql_error());


    $insertGoTo = "wyumiao.php";
    if (isset($_SERVER['QUERY_STRING'])) {
        $insertGoTo .= ( strpos($insertGoTo, '?')) ? "&" : "?";
        $insertGoTo .= $_SERVER['QUERY_STRING'];
    }
    header(sprintf("Location: %s", $insertGoTo));
}
?><title>录入育苗信息</title><?php ?>
<style type="text/css">
<!--
.STYLE1 {font-size: 14px}
-->
</style>
<a href="dryumiao.php" class="STYLE1">返回</a>
<form id="form1" name="form1" method="POST" action="<?php echo $editFormAction; ?>">
    <table width="400" border="1" align="center" cellpadding="0" cellspacing="0">

        <tr>
            <td width="53"><div align="left" class="STYLE1">
                    <div align="center">名称</div>
                </div></td>
            <td width="141"><label>
                    <input name="area1" type="text" id="area1" />
                </label></td>
        </tr>
        <tr>
            <td><div align="left" class="STYLE1">
                    <div align="center">壮苗选择</div>
                </div></td>
            <td><label>
                    <textarea name="area2" id="area2"></textarea>
                </label></td>
        </tr>
        <tr>
            <td><div align="left" class="STYLE1">
                    <div align="center">种子消毒</div>
                </div></td>
            <td><label>
                    <textarea name="area3" id="area3"></textarea>
                </label></td>
        </tr>
        <tr>
            <td><div align="left" class="STYLE1">
                    <div align="center">基质配比</div>
                </div></td>
            <td><label>
                    <textarea name="area4" id="area4"></textarea>
                </label></td>
        </tr>
        <tr>
            <td><div align="left" class="STYLE1">
                    <div align="center">播种时间</div>
                </div></td>
            <td><textarea name="area5" id="area5"></textarea></td>
        </tr>
        <tr>
            <td><div align="left" class="STYLE1">
                    <div align="center">播种光照</div>
                </div></td>
            <td><textarea name="area6" id="area6"></textarea></td>
        </tr>
        <tr>
            <td><div align="left" class="STYLE1">
                    <div align="center">播种温度</div>
                </div></td>
            <td><textarea name="area7" id="area7"></textarea></td>
        </tr>
        <tr>
            <td><div align="left" class="STYLE1">
                    <div align="center">播种水分</div>
                </div></td>
            <td><textarea name="area8" id="area8"></textarea></td>
        </tr>
        <tr>
            <td><div align="left" class="STYLE1">
                    <div align="center">发芽时长</div>
                </div></td>
            <td><textarea name="area9" id="area9"></textarea></td>
        </tr>
        <tr>
            <td><div align="left" class="STYLE1">
                    <div align="center">发芽光照</div>
                </div></td>
            <td><textarea name="area10" id="area10"></textarea></td>
        </tr>
        <tr>
            <td><div align="left" class="STYLE1">
                    <div align="center">发芽日温</div>
                </div></td>
            <td><textarea name="area11" id="area11"></textarea></td>
        </tr>
        <tr>
            <td><div align="left" class="STYLE1">
                    <div align="center">发芽夜温</div>
                </div></td>
            <td><textarea name="area12" id="area12"></textarea></td>
        </tr>
        <tr>
            <td><div align="left" class="STYLE1">
                    <div align="center">发芽水分</div>
                </div></td>
            <td><textarea name="area13" id="area13"></textarea></td>
        </tr>
        <tr>
            <td><div align="left" class="STYLE1">
                    <div align="center">幼苗期时长</div>
                </div></td>
            <td><textarea name="area14" id="area14"></textarea></td>
        </tr>
        <tr>
            <td><div align="left" class="STYLE1">
                    <div align="center">幼苗期光照</div>
                </div></td>
            <td><textarea name="area15" id="area15"></textarea></td>
        </tr>
        <tr>
            <td><div align="left" class="STYLE1">
                    <div align="center">幼苗期日温</div>
                </div></td>
            <td><textarea name="area16" id="area16"></textarea></td>
        </tr>
        <tr>
            <td><div align="left" class="STYLE1">
                    <div align="center">幼苗期夜温</div>
                </div></td>
            <td><textarea name="area17" id="area17"></textarea></td>
        </tr>
        <tr>
            <td><div align="left" class="STYLE1">
                    <div align="center">幼苗期水分</div>
                </div></td>
            <td><textarea name="area18" id="area18"></textarea></td>
        </tr>
        <tr>
            <td colspan="2"><div align="center">
                    <label>
                        <input type="submit" name="Submit" value="提交" />
                        &nbsp;&nbsp;&nbsp;&nbsp; </label>
                    <label>
                        <input type="reset" name="Submit2" value="重置" />
                    </label>
                </div></td>
        </tr>
    </table>
    <input type="hidden" name="MM_insert" value="form1">
</form>
